import '../../../../resource/component/css/component_v2_pc.css'
import '../common/common.scss';

import Vue from 'vue';

import Loading from 'packages/BaseLoading'

import { Popover, Tooltip } from 'element-ui';
import BaseTable from 'packages/BaseTable';
import StatsPopverIcon from '../common/StatsPopoverIcon.vue';

import PlanView from './PlanView.vue'

import Platform from '@src/util/platform.ts';
import filters from '@src/filter/filter';

import * as mtracker from '../../../util/Mtrackers';
import DatePicker from '../common/DataTime.vue'

mtracker.initializeTalkingData();

for(let name in filters) Vue.filter(name, filters[name]);

Vue.component(Popover.name, Popover);
Vue.component(DatePicker.name, DatePicker)
Vue.component(Tooltip.name, Tooltip);
Vue.component(StatsPopverIcon.name, StatsPopverIcon)
Vue.component(BaseTable.name, BaseTable);

Vue.prototype.$platform = Platform;
Vue.prototype.$loading = Loading;
Vue.prototype.$tdOnEvent = mtracker.onEvent;

const componentItem = () => {
  return {
    render(h) {
      return h(PlanView);
    }
  }
}

Vue.component('async-component', async function(resolve) {
  // 初始化高德地图
  try{
    await __initAmap();
  }catch(err){
    console.warn('amapinit error', err)
  }
  // 需要加loading 打开此注释
  // const instance = Loading.service({ fullscreen: true });
  resolve(componentItem())
});

let app = {
  render(h) {
    return <async-component />
  }
}

export default app;     